var mainController = angular.module('mainController', []);


mainController.controller('MainController', function($scope) {
	$scope.dataTable = [];
	$scope.rowselect  = {};
	

	$scope.InitData = function () {
		$scope.dataTable = [
		{"id":1,"firstname":"Van fdsHoan", "lastname":"hoafn Van", "username":"hrwerachiko" },
		{"id":2,"firstname":"Vansdf Hoan", "lastname":"hoan Van", "username":"hadsfchiko" },
		{"id":3,"firstname":"Van Hoan", "lastname":"hoan Van", "username":"hachiko" },
		{"id":4,"firstname":"Van Hosdfan", "lastname":"hsoan Van", "username":"hachiko" },
		{"id":5,"firstname":"Van sHoan", "lastname":"hoasn Van", "username":"hacsdfhiko" },
		{"id":6,"firstname":"Van Hoan", "lastname":"hoan Van", "username":"hachiko" },
		{"id":7,"firstname":"Van sdfHoasn", "lastname":"hoan Van", "username":"hachiko" },
		{"id":8,"firstname":"Van Hoan", "lastname":"hoan Van", "username":"hach44iko" },
		{"id":9,"firstname":"Van Hoan", "lastname":"hoan Van", "username":"hachwerko" },
		{"id":10,"firstname":"Van Hoan", "lastname":"hoan Van", "username":"ddd" }];
		$scope.rowselect  = $scope.dataTable[0];

	}

	
	$scope.ClickRow = function  (id) {

		for( i=0; i<$scope.dataTable.length; i++){
			if($scope.dataTable[i].id == id){
				$scope.rowselect = $scope.dataTable[i];
				//alert( $scope.dataTable[i].username);
			}	
		}
	};
});